package hng.mapper;

import hng.model.ProductSpecDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * <p>
 * 商品规格表 Mapper 接口
 * </p>
 *
 * @author 告白
 * @since 2024-06-27
 */
public interface ProductSpecMapper extends BaseMapper<ProductSpecDO> {

    /**
     * 通过商品id批量删除
     */
    @Delete({
            "<script>",
            "DELETE FROM product_spec ",
            "WHERE product_id IN ",
            "<foreach item='id' collection='idList' open='(' separator=',' close=')'> ",
            "#{id} ",
            "</foreach> ",
            "</script>"
    })
    void deleteByProductIds(@Param("idList") List<Integer> idList);
}
